

<table width="100%" border="0" cellpang="0" cellspacing="0">
    <tr>
        <td class="left" >&nbsp;
            작성자 : <input class="w_200" type="text" id="user_nick" name="user_nick"value="" onmouseover="bbs.getFocus(this);"> 
            비밀번호 : <input class="w_200" type="password" id="remove_password"  name="remove_password" value="">
        </td>
    </tr>
    <tr>
        <td class="left">&nbsp;<input type="text" id="board_subject" name="board_subject"  value="" style="width: 100%; ">
        </td>
    </tr>
    <tr>
        <td class="left">
            <textarea  id="content"  name="content" class="CLEditor" >
            </textarea>
            <div id="mulitplefileuploader" >파일탐색</div>
            <div id="status"></div>
        </td>
    </tr>
    <tr>
        <td align="center" class="padding" >
            <input type="image" src="<?= $FOLDER_PATH; ?>/img/bt_list.gif" value="목록" onClick="bbs.swapPage('<?= $PAGE_LIST; ?>', '<?= $layer_id; ?>');
                    return false;">
                   <?php if ($bbs_mode == "write") { ?>
                <input type="image" src="<?= $FOLDER_PATH; ?>/img/bt_confirm.gif" onClick="writeCheck();
                            return false;">
                   <?php } else if ($bbs_mode == "re") { ?>
                <input type="image" src="<?= $FOLDER_PATH; ?>/img/bt_confirm.gif" value="등록" onClick="reCheck();
                            return false;">
                   <?php } ?>
        </td>
    </tr>
</table>
<script  language='JavaScript' charset='utf-8'>

    $(document).ready(function () {
        $(".CLEditor").cleditor({width: "100%", height: "500px"})[0].focus();
        var settings = {
            url: "<?= SCRIPT_ROOT; ?>upload/upload.php",
            dragDrop: true,
            fileName: "myfile",
            allowedTypes: "jpg,png,gif,doc,pdf,zip",
            returnType: "json",
            contentType: "application/x-www-form-urlencoded; charset=UTF-8",
            onSuccess: function (files, data, xhr)
            {
                alert((data));
            },
            showDelete: true,
            deleteCallback: function (data, pd)
            {
                for (var i = 0; i < data.length; i++)
                {
                    $.post("<?= SCRIPT_ROOT; ?>upload/delete.php", {op: "delete", name: data[i]},
                    function (resp, textStatus, jqXHR)
                    {
                        //Show Message  
                        $("#status").append("<div>파일명 : " + pd.filename.text() + " 삭제되었습니다.</div>");
                    });
                }
                pd.statusbar.hide(); //You choice to hide/not.
            }
        };
        var uploadObj = $("#mulitplefileuploader").uploadFile(settings);
    });


    function joinCheck() {
        if ($("#user_nick").val() < 2) {
            alert("이름은 최소 2자이상 입력해야 합니다.");
            $("#user_nick").focus();
            return false;
        }
        if ($("#board_subject").val() < 1) {
            alert("제목이 없습니다.");
            $("#board_subject").focus();
            return false;
        }
        if ($("#board_content").val() < 1) {
            alert("내용이 없습니다.");
            // $("#content").focus(); 안먹힘
            return false;
        }
        return true;
    }
//일반글 전송
    function writeCheck() {
        //아무이상 없으면 글쓰기실행
        if (joinCheck()) {
            bbs.swapPage("<?= $PAGE_WRITE_OK; ?>", "<?= $layer_id; ?>", function () {
                bbs.swapPage("<?= $PAGE_LIST; ?>", "<?= $layer_id; ?>");
            }, "html", $("#content").val(), $("#user_nick").val(), $("#remove_password").val(), $("#board_subject").val(), "<?= $_F->makeToken($SESSION_WRITE); ?>");
        }
    }



</script>




